import requests
# 获取session对象
session = requests.session()  # 开启会话

# 1.获取验证码
rep = session.get(url="http://localhost/index.php?m=Home&c=User&a=verify")
print(rep.status_code)

# 2.登录
login_data={
    "username":"13088888888",
    "password":"123456",
    "verify_code":"8888"
}
rep2 = session.post(url="http://localhost/index.php?m=Home&c=User&a=do_login",data=login_data)
print(rep2.json())
# 3.查看订单
rep3 = session.get(url="http://localhost/Home/Order/order_list.html")
print(rep3.text)

# session相当于一次会话，用完要关闭
session.close()